package com.cloud.logger.zchain.common.entity.builder;


import com.cloud.logger.zchain.common.entity.AngelaLoggerEntity;

import java.util.Date;

/**
 * 卓锐科技有限公司
 * Created by wmm on 2017/5/18.
 * email：6492178@gmail.com
 * description:
 *
 * @author wmm
 */

public final class AngelaLoggerEntityBuilder {
    private String id;
    //给子节点使用
    private String uuid;
    //接口名
    private String interfaceName;
    //接口ip地址
    private String interfaceIp;
    //接口ipport
    private Integer interfacePort;
    private Date createTime;
    private Date updateTime;
    //消耗时间
    private Long elapsedTime;
    //客户请求ip
    private String sourceIP;
    //所属租户信息
    private String tenentId;
    //请求参数
    private String parms;
    //请求结果
    private String result;
    //所属类型(error,debugger,info)
    private String type;
    //请求方式（INTERCEPTOR，HTTPCLIENT, LOGGER）
    private String pattern;
    //状态(8200,8500,200,500,404等)
    private String status;
    //警报等级（1：正常，2：警报，3：错误，4：严重错误）
    private Integer alarmLevel;
    //父节点的uuid，rpc或者httpclient请求时使用（拦截器时为空）
    private String parentNode;
    //HTTP请求消息中的请求方式
    private String method;
    //所属景区
    private String scenic;
    //所属项目
    private String project;
    //接口描述
    private String description;

    private AngelaLoggerEntityBuilder() {
    }

    public static AngelaLoggerEntityBuilder anAngelaLoggerEntity() {
        return new AngelaLoggerEntityBuilder();
    }

    public AngelaLoggerEntityBuilder withId(String id) {
        this.id = id;
        return this;
    }

    public AngelaLoggerEntityBuilder withUuid(String uuid) {
        this.uuid = uuid;
        return this;
    }

    public AngelaLoggerEntityBuilder withInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
        return this;
    }

    public AngelaLoggerEntityBuilder withInterfaceIp(String interfaceIp) {
        this.interfaceIp = interfaceIp;
        return this;
    }

    public AngelaLoggerEntityBuilder withInterfacePort(Integer interfacePort) {
        this.interfacePort = interfacePort;
        return this;
    }

    public AngelaLoggerEntityBuilder withCreateTime(Date createTime) {
        this.createTime = createTime;
        return this;
    }

    public AngelaLoggerEntityBuilder withUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
        return this;
    }

    public AngelaLoggerEntityBuilder withElapsedTime(Long elapsedTime) {
        this.elapsedTime = elapsedTime;
        return this;
    }

    public AngelaLoggerEntityBuilder withSourceIP(String sourceIP) {
        this.sourceIP = sourceIP;
        return this;
    }

    public AngelaLoggerEntityBuilder withTenentId(String tenentId) {
        this.tenentId = tenentId;
        return this;
    }

    public AngelaLoggerEntityBuilder withParms(String parms) {
        this.parms = parms;
        return this;
    }

    public AngelaLoggerEntityBuilder withResult(String result) {
        this.result = result;
        return this;
    }

    public AngelaLoggerEntityBuilder withType(String type) {
        this.type = type;
        return this;
    }

    public AngelaLoggerEntityBuilder withPattern(String pattern) {
        this.pattern = pattern;
        return this;
    }

    public AngelaLoggerEntityBuilder withStatus(String status) {
        this.status = status;
        return this;
    }

    public AngelaLoggerEntityBuilder withAlarmLevel(Integer alarmLevel) {
        this.alarmLevel = alarmLevel;
        return this;
    }

    public AngelaLoggerEntityBuilder withParentNode(String parentNode) {
        this.parentNode = parentNode;
        return this;
    }

    public AngelaLoggerEntityBuilder withMethod(String method) {
        this.method = method;
        return this;
    }

    public AngelaLoggerEntityBuilder withScenic(String scenic) {
        this.scenic = scenic;
        return this;
    }

    public AngelaLoggerEntityBuilder withProject(String project) {
        this.project = project;
        return this;
    }

    public AngelaLoggerEntityBuilder withDescription(String description) {
        this.description = description;
        return this;
    }

    public AngelaLoggerEntity build() {
        AngelaLoggerEntity angelaLoggerEntity = new AngelaLoggerEntity();
        angelaLoggerEntity.setId(id);
        angelaLoggerEntity.setUuid(uuid);
        angelaLoggerEntity.setInterfaceName(interfaceName);
        angelaLoggerEntity.setInterfaceIp(interfaceIp);
        angelaLoggerEntity.setInterfacePort(interfacePort);
        angelaLoggerEntity.setCreateTime(createTime);
        angelaLoggerEntity.setUpdateTime(updateTime);
        angelaLoggerEntity.setElapsedTime(elapsedTime);
        angelaLoggerEntity.setSourceIP(sourceIP);
        angelaLoggerEntity.setTenentId(tenentId);
        angelaLoggerEntity.setParms(parms);
        angelaLoggerEntity.setResult(result);
        angelaLoggerEntity.setType(type);
        angelaLoggerEntity.setPattern(pattern);
        angelaLoggerEntity.setStatus(status);
        angelaLoggerEntity.setAlarmLevel(alarmLevel);
        angelaLoggerEntity.setParentNode(parentNode);
        angelaLoggerEntity.setMethod(method);
        angelaLoggerEntity.setScenic(scenic);
        angelaLoggerEntity.setProject(project);
        angelaLoggerEntity.setDescription(description);
        return angelaLoggerEntity;
    }
}
